package xyz.xtt.asset.api.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author huqibo
 * @date 2024/12/26
 */
public enum OwnerTypeEnum {
	/**
	 * 通宝支付
	 */
	USER(0, "用户"),
	/**
	 * 通宝支付
	 */
	PLATFORM(1, "平台"),
	/**
	 * 通钻
	 */
	AGENT(2, "代理商");

	/**
	 * 编码
	 */
	private int code;
	/**
	 * 描述
	 */
	private String desc;

	private OwnerTypeEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public int code() {
		return code;
	}

	public String desc() {
		return desc;
	}

	public static OwnerTypeEnum queryConvert(Integer checkType) {
		return Arrays.asList(OwnerTypeEnum.values()).stream().filter(x -> Objects.equals(x.code(), checkType)).findFirst().orElse(null);
	}
}
